package util.PluginTools;

import abbot.util.AWTFixtureHelper;
import allTests.TestDataProcess;
import com.supermap.desktop.core.Interface.IBaseItem;
import com.supermap.desktop.core.implement.CtrlAction;
import operation.Operation;
import operation.WorkspaceTreeOperation;

import static operation.Operation.robot;

/**
 * 点击开始ribbon中的执行，执行自动化，执行哪个用例在下面修改调用方法
 * 将配置文件SuperMap.Desktop.JUnitPlugin.config放到WorkEnvironment中加载此插件
 */
public class CtrlActionAutoRun extends CtrlAction {
	Thread thread;

	public CtrlActionAutoRun(IBaseItem caller) {
		super(caller);
	}

	public void run() {
		if (this.thread != null) {
			try {
				this.thread.interrupt();
			} catch (Exception var2) {
				var2.getMessage();
			}
		}

		this.thread = new Thread(new Runnable() {
			public void run() {
				try {
					Operation.helper = new AWTFixtureHelper();
					robot = Operation.helper.getRobot();
//					new ProcessTreeToFile().getTreeNodes();
					//执行哪个自动化修改这里
//					new IFormOperation().activeForm("");
					TestDataProcess testclass = new TestDataProcess();
					testclass.testProjectionTransform();
					WorkspaceTreeOperation.closeWorkspace();
					System.out.println(testclass.errorCollector.toString());
				} catch (Exception e) {
					e.printStackTrace();
				}
			}
		});
		this.thread.start();
	}
}
